﻿<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style>
			img{
				width:280px;
			}
		</style>
	</head>
	<body>
		<img src="imges/1.jpg" id="pic"/><br />
		<input type="button" value="上一张" onclick="siaYiZhang()"/>
		<input type="button" value="下一张" onclick="xiaYiZhang()"/>
		<script>
			var i=1;
			var xiaYiZhang=function(){
				if(i<5){
					i++;
				}else{
					alert("已经是最后一张");
				}
				pic.src="imges/"+i+".jpg";
			}
			var siaYiZhang=function(){
				if(i<=1){
					alert("已经是第一张了");
				}else{
					i--;
				}
				pic.src="imges/"+i+".jpg";
			}
		</script>
	</body>
</html>
